@extends('user.base')

@section('content-header','Patient List')

@section('content-header-small')
	<p>{{ session()->get('username')}}</p>
@endsection

@section('content-body')
<!-- Main content -->
<section class="content">
	<!--Patient list section-->
	<div class="container-fluid">	
			<div class="padding border-bottom">
				<a href="{{ URL('patient/info/create/')}}" class="btn btn-primary btn-large">Add New Patient</a>			
			</div>
			<br>		
		<div class="table-responsive">
		<table class="table table-hover table-striped table-responsive">
			<tr>				
				<th width="200">Patient Name</th>
				<th width="200">Sex</th>
				<th width="50">Age</th>
				<th width="50">OS</th>
				<th width="50">OD</th>
				<th width="*">Description</th>
				<th width="200">Action</th>
			</tr>		
			@foreach($patients as $patient)
			<tr>
				<td>							
					<a href="{{ URL('patient/info/'.$patient->id)}}">
						<h4>{{ $patient->first_name." ".$patient->last_name }}</h4>
					</a>
				</td>
				<td>
					<h5>{{ $patient->sex }}</h5>
				</td>
				<td>					
					<h5>{{ $patient->age }}</h4>
				</td>
				<td>
					<h5>{{ $patient->eyesight_left}}</h4>
				</td>
				<td>
					<h5>{{ $patient->eyesight_right}}</h4>
				</td>
				<td>
					<h5>{{ $patient->description }}</h5>
				</td>	
				<td>
					<table>
						<td>
							<form action="{{ URL('patient/info/'.$patient->id)}}">
								<input type="hidden" name="_token" value="{{ csrf_token() }}">
								<input type="hidden" name="_method" value="GET">
								<button type="submit" class="btn btn-success">Update</button>
							</form>
						</td>
						<td>
							<form action="{{ URL('patient/info/'.$patient->id )}}" method="POST" style="display:inline">
								<input type="hidden" name="_token" value="{{ csrf_token()}}">
								<input type="hidden" name="_method" value="DELETE">
								<button type="submit" class="btn btn-danger">Delete</button>
							</form>
						</td>
					</table>
				</td>
			</tr>
			@endforeach		
		</table>
		{!! $patients->render() !!}
		</div>
	</div>
</section>
@endsection